home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 17148 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.4 KB

  1. Path: prairienet.org!wemccaug
  2. From: wemccaug@prairienet.org (Wendy E. McCaughrin)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: what does this code do?
  5. Date: 14 Apr 1996 01:15:09 GMT
  6. Organization: University of Illinois at Urbana
  7. Message-ID: <4kpjit$74s@vixen.cso.uiuc.edu>
  8. References: <3167217D.AC7@lex.infi.net> <4k6u2v$i2c@newsbf02.news.aol.com>
  9. Reply-To: wemccaug@prairienet.org (Wendy E. McCaughrin)
  10. NNTP-Posting-Host: firefly.prairienet.org
  11.  
  12.  
  13. In a previous article, hightowr@lex.infi.net (Scott Hightower) says:
  14.  
  15. >Mrdavc wrote:
  16. >> 
  17. >> linePtrs[currentLine][lineLen[currentLine]] = (char) key;
  18. >> 
  19. >> What does this code do?  It looks like linePtrs is a multidimensional
  20. >> array but its not defined that way.  is both linePtrs[currentLine] and
  21. >> lineLen[currentLine] set to (char) key??
  22. >> 
  23. >> example from Teach yourself Turbo C++ 4.5 for Windows by Craig Arnush
  24. >> p,355
  25. >
  26.  Why not just do what the compiler does and parse the expression? 
  27.  'currentLine' must be some positive integer to be used as a sub-
  28.  script and 'lineLen' is an array of positive integers (I suppose,
  29.  line lengths) to be used as the second subscript to 'linePtrs'.
  30.  Then 'linePtrs' is a 2-dimensional array of chars, apparently
  31.  (since it is assigned a char). Interpretation: each line of the
  32.  2-D array may be a character-string (so 'linePtrs' is like argv)
  33.  and since origins begin at 0, lineLen[currentLine] is the index
  34.  of the null-terminator, where (char)key goes in the current line.
  35.  
  36.